package com.top.mall.jetpack.ma

import com.module.lemlin.http.HttpResponseData
import com.top.mall.app.BaseApplication
import com.top.mall.base.BaseManager
import com.top.mall.entity.*
import rxhttp.RxHttp
import rxhttp.await

class CouponManager : BaseManager() {

    /**
     * 1=积分兑换;2=配送返还;3=拼团返还
     * */
    suspend fun userCoupon(source_type: Int): UserCouponResponse =
        RxHttp.get("/api/cash_coupon/userCoupon")
            .add("source_type", source_type)
            .await()

    suspend fun userCouponScore(): CouponScoreResponse =
        RxHttp.get("/api/cash_coupon/scoreCashCouponList")
            .await()


    suspend fun userCouponExchange(money: Int): HttpResponseData =
        RxHttp.get("/api/cash_coupon/exchangeScoreCashCoupon")
            .add("money",money)
            .await()
}